<?php
/**
 * Created by PhpStorm.
 * User: jack
 * Date: 14/10/19
 * Time: 下午7:07
 */

namespace Wilead\IArtistBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

/**
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Wilead\IArtistBundle\Repository\MomentsRepository")
 */
class Moments
{
    /**
     * @ORM\Column(type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @ORM\Column(type="text", nullable=true)
     */
    private $content;

    /**
     * @Gedmo\Timestampable(on="create")
     * @ORM\Column(type="datetime")
     */
    private $publishAt;

    /**
     * @ORM\OneToMany(targetEntity="MonmentsAttachment", mappedBy="Monments", cascade={"persist"})
     * @ORM\OrderBy({"createdAt" = "ASC"})
     * */
    private $Attachments;

    /**
     * @ORM\ManyToOne(targetEntity="User")
     * @ORM\JoinColumn(name="userId", referencedColumnName="id", nullable=false)
     * */
    private $User;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->Attachments = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set content
     *
     * @param string $content
     * @return Moments
     */
    public function setContent($content)
    {
        $this->content = $content;

        return $this;
    }

    /**
     * Get content
     *
     * @return string
     */
    public function getContent()
    {
        return $this->content;
    }

    /**
     * Set publishAt
     *
     * @param \DateTime $publishAt
     * @return Moments
     */
    public function setPublishAt($publishAt)
    {
        $this->publishAt = $publishAt;

        return $this;
    }

    /**
     * Get publishAt
     *
     * @return \DateTime
     */
    public function getPublishAt()
    {
        return $this->publishAt;
    }

    /**
     * Add Attachments
     *
     * @param \Wilead\IArtistBundle\Entity\MonmentsAttachment $attachments
     * @return Moments
     */
    public function addAttachment(\Wilead\IArtistBundle\Entity\MonmentsAttachment $attachments)
    {
        $this->Attachments[] = $attachments;

        return $this;
    }

    /**
     * Remove Attachments
     *
     * @param \Wilead\IArtistBundle\Entity\MonmentsAttachment $attachments
     */
    public function removeAttachment(\Wilead\IArtistBundle\Entity\MonmentsAttachment $attachments)
    {
        $this->Attachments->removeElement($attachments);
    }

    /**
     * Get Attachments
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getAttachments()
    {
        return $this->Attachments;
    }

    /**
     * Set User
     *
     * @param \Wilead\IArtistBundle\Entity\User $user
     * @return Moments
     */
    public function setUser(\Wilead\IArtistBundle\Entity\User $user)
    {
        $this->User = $user;

        return $this;
    }

    /**
     * Get User
     *
     * @return \Wilead\IArtistBundle\Entity\User
     */
    public function getUser()
    {
        return $this->User;
    }
}
